Skip to content

ktesting: fix vmodule support#431

Merged
k8s-ci-robot merged 1 commit intokubernetes:mainfrom
pohly:ktesting-vmodule-fix
Feb 23, 2026
Merged

ktesting: fix vmodule support#431
k8s-ci-robot merged 1 commit intokubernetes:mainfrom
pohly:ktesting-vmodule-fix

Conversation

@pohly
Copy link
Copy Markdown

@pohly pohly commented Dec 1, 2025

What this PR does / why we need it:

Stack unwinding to determine the caller must consider the number of call levels to skip over in logr itself. This only affected the Enabled check and thus usage of the vmodule parameter, the actual caller then gets printed by testing.T.

This also leads to a small inconsistency: the enabled check is unaware of the testing.T.Helper calls and can only check the direct caller, without skipping helpers, while the actual log output then skips the helper. There's no good fix for this, testing.T would need an API for delegating the stack unwinding to the caller (would also be useful to log a PC supplied via slog...).

Which issue(s) this PR fixes:

Fixes #420

Special notes for your reviewer:

One line change, multi-line unit test...

Release note:

ktesting: -testing.vmodule was off by one in the call stack when checking whether log ouput should be printed.

Stack unwinding to determine the caller must consider the number of call levels
to skip over in logr itself. This only affected the `Enabled` check and thus
usage of the vmodule parameter, the actual caller then gets printed by
testing.T.

This also leads to a small inconsistency: the enabled check is unaware of the
testing.T.Helper calls and can only check the direct caller, without skipping
helpers, while the actual log output then skips the helper. There's no good fix
for this, testing.T would need an API for delegating the stack unwinding to the
caller (would also be useful to log a PC supplied via slog...).
@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Dec 1, 2025
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Dec 1, 2025
@pohly
Copy link
Copy Markdown
Author

pohly commented Dec 1, 2025

/assign @harshanarayana

@dgrisonnet
Copy link
Copy Markdown
Member

/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Dec 12, 2025
@tallclair
Copy link
Copy Markdown
Member

/assign

Copy link
Copy Markdown

@nojnhuh nojnhuh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

/hold in case @tallclair still wanted to take a look.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 23, 2026
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 23, 2026
@k8s-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nojnhuh, pohly

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@pohly
Copy link
Copy Markdown
Author

pohly commented Feb 23, 2026

/hold cancel

I think @tallclair is too busy to look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ktesting: -vmodule not working

6 participants